/**
 * Copyright (C) 2025 pony working team
 * SPDX-License-Identifier: MulanPSL-2.0
 */

/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __PONY_HAL_SDIO_H__
#define __PONY_HAL_SDIO_H__

/* includes (standard library, system) ---------------------------------------*/
/* includes (other library) --------------------------------------------------*/
/* includes (project) --------------------------------------------------------*/
/* includes (local) ----------------------------------------------------------*/
#include "hal.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/* defines -------------------------------------------------------------------*/
/* typedefs ------------------------------------------------------------------*/

typedef struct hal_sdio hal_sdio_t;

typedef struct hal_sdio_methods {
    int (*ioctl)(hal_sdio_t *, int, va_list);
} hal_sdio_methods_t;

struct hal_sdio {
    hal_dev_t parent;
    const hal_sdio_methods_t *methods;
};

/* macro ---------------------------------------------------------------------*/
/* inlines -------------------------------------------------------------------*/
/* externs -------------------------------------------------------------------*/

extern hal_sdio_t *hal_sdio_open(const char *name);
extern int hal_sdio_close(hal_sdio_t *sdio);
extern int hal_sdio_ioctl(hal_sdio_t *sdio, int cmd, ...);
extern int hal_sdio_register(hal_sdio_t *sdio, const char *name, const hal_sdio_methods_t *methods,
                             uintptr_t data);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __PONY_HAL_SDIO_H__ */
